# sphinx_gallery_thumbnail_number = 2

import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib import cm
from collections import OrderedDict


def Get_cmaps():
    """
    获取彩色颜色条
    :return:
    """
    # 初始化并加载颜色名称
    cmaps = OrderedDict()
    cmaps['Perceptually Uniform Sequential'] = [
                'viridis', 'plasma', 'inferno', 'magma', 'cividis']
    cmaps['Sequential'] = [
                'Greys', 'Purples', 'Blues', 'Greens', 'Oranges', 'Reds',
                'YlOrBr', 'YlOrRd', 'OrRd', 'PuRd', 'RdPu', 'BuPu',
                'GnBu', 'PuBu', 'YlGnBu', 'PuBuGn', 'BuGn', 'YlGn']
    cmaps['Sequential (2)'] = [
                'binary', 'gist_yarg', 'gist_gray', 'gray', 'bone', 'pink',
                'spring', 'summer', 'autumn', 'winter', 'cool', 'Wistia',
                'hot', 'afmhot', 'gist_heat', 'copper']
    cmaps['Diverging'] = [
                'PiYG', 'PRGn', 'BrBG', 'PuOr', 'RdGy', 'RdBu',
                'RdYlBu', 'RdYlGn', 'Spectral', 'coolwarm', 'bwr', 'seismic']
    cmaps['Cyclic'] = ['twilight', 'twilight_shifted', 'hsv']
    cmaps['Qualitative'] = ['Pastel1', 'Pastel2', 'Paired', 'Accent',
                            'Dark2', 'Set1', 'Set2', 'Set3',
                            'tab10', 'tab20', 'tab20b', 'tab20c']
    cmaps['Miscellaneous'] = [
                'flag', 'prism', 'ocean', 'gist_earth', 'terrain', 'gist_stern',
                'gnuplot', 'gnuplot2', 'CMRmap', 'cubehelix', 'brg',
                'gist_rainbow', 'rainbow', 'jet', 'nipy_spectral', 'gist_ncar']
    return cmaps

# 获取RGB随机颜色
def GetRandomColors(Howmany=1):
    """
    # 获取RGB随机颜色
    :param Howmany: 获取的RGB数量
    :return:
    返回的结构为列表嵌套,如[[0.1,0.2,0.3]]这样子的结构
    """
    Colors = []
    for i in range(Howmany):
        RGB = []
        for j in range(3):
            RGB.append(np.random.randint(0, 255) / 255)
        Colors.append(RGB)
    return Colors